package com.dunqi.gpm.cangxi.home.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseViewHolder;
import com.dunqi.gpm.cangxi.R;
import com.dunqi.gpm.cangxi.common.base.RecyclerAdapter;
import com.dunqi.gpm.cangxi.common.util.Arith;
import com.dunqi.gpm.cangxi.home.bean.Project;
import com.dunqi.gpm.cangxi.home.constance.Constance;

import java.util.List;

/**
 * Created by 空 on 2017/11/17 0017.
 */

public class KnotAdapter extends RecyclerAdapter<Project> {

    private final String[] status;

    public KnotAdapter(@Nullable List<Project> data) {
        super(R.layout.item_knot, data);
        status = Constance.STATUS;
    }

    @Override
    protected void convert(BaseViewHolder helper, Project item) {

        double totalInvestmentAmount = item.getTotalInvestmentAmount();
        if (totalInvestmentAmount == 0) {
            helper.setText(R.id.money_tv, "年度投资:");
        } else {
            String aDouble = Arith.get2Double(totalInvestmentAmount);
            helper.setText(R.id.money_tv, "年度投资:" + aDouble + "万元");
        }
        helper.setText(R.id.title_tv, item.getProjectName())
                .setText(R.id.plan_year_tv, "计划年度:" + item.getPlanYear() + "年");
    }


}
